<HTML><HEAD><TITLE>number_sort(+List1, -List2)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Comparing and Sorting</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>number_sort(+List1, -List2)</H1>
Succeeds if List2 is the numerically ordered version of List1.


<DL>
<DT><EM>List1</EM></DT>
<DD>List of numeric terms.
</DD>
<DT><EM>List2</EM></DT>
<DD>List of numeric terms or variable.
</DD>
</DL>
<H2>Description</H2>
   List1 is sorted according to numerical ordering, and unified with List2.
<P>
   The sort is done according to numerical ordering and duplicates are
   retained as opposed to sort/2 which uses the standard ordering of
   terms and removes duplicates. See number_sort/4 for a discussion of
   the differences between numerical and standard ordering of numeric types.
<P>
Note
   number_sort(L1,L2) is equivalent to number_sort(0,=&lt;,L1,L2).

<H3>Modes and Determinism</H3><UL>
<LI>number_sort(+, -) is det
</UL>
<H2>Examples</H2>
<PRE>
Success:
      sort([3,1,6,7,2],S).     (gives S=[1,2,3,6,7]).
      sort([1,3,2,3,4,1],S).   (gives S=[1,1,2,3,3,4]).
Fail:
      sort([2,1,3,4],[2,1,3,4]).



</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/termcomp/number_sort-4.html">number_sort / 4</A>, <A HREF="../../kernel/termcomp/sort-2.html">sort / 2</A>, <A HREF="../../kernel/termcomp/sort-4.html">sort / 4</A>
</BODY></HTML>
